Skip to content

chore(ci): add PyPI trusted publishing workflow - #470

Open
jahirvidrio wants to merge 1 commit into
ekalinin:masterfrom
jahirvidrio:ci/release-workflow
Open

jahirvidrio wants to merge 1 commit into
ekalinin:masterfrom
jahirvidrio:ci/release-workflow

Conversation

@jahirvidrio

@jahirvidrio jahirvidrio commented Nov 13, 2026 •

Copy link
Copy Markdown

Adds .github/workflows/release.yml, the trusted publishing workflow discussed in #416. Pushing a bare version tag builds the sdist and wheel with python -m build and uploads them to PyPI through OIDC, with no credentials stored in the repository. No other workflow is touched.

The guard rails:

  • Only push on tags matching digit.digit.digit triggers it, so an unrelated tag like docs-2026 leaves the workflow alone.
  • Every action is pinned by SHA with the version in the trailing comment, so Dependabot keeps bumping them like the rest of the repo.
  • id-token: write is granted to the publish job only. build keeps the workflow-level contents: read.
  • publish runs in the pypi environment.
  • The tag check runs before the build and compares GITHUB_REF_NAME with nodeenv_version from nodeenv.py, so a mismatch fails in seconds instead of after the dist is built. If the value cannot be read, the step fails loudly rather than comparing against an empty string.
  • build runs twine check on both artifacts, installs the wheel into a throwaway venv and compares nodeenv --version with the tag. A broken wheel fails the job, and publish needs build.
  • publish uploads the artifact build produced and checked, nothing else.

Tests are not part of this change: it adds one workflow file, and nothing in tests/ covers .github/. I kept the diff to release.yml as asked.

Fixes #416

  • Tests cover the change
  • tox passes: the tests and flake8
  • CHANGES has an entry under Version [unreleased], if nodeenv's
    behavior changes
  • README.rst is updated, if the change affects what it documents
  • The title has the form type(scope): subject

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The release smoke test can skip installing the built wheel because leftover nodeenv.egg-info appears already installed, leaving no bin/nodeenv and blocking publication; the install needs --force-reinstall.

1 open issue
What changed in this PR

Adds tag-triggered PyPI trusted publishing for nodeenv, implementing the automation proposed in #416 while keeping release timing under maintainer control.

Changes:

  • Checks that the version tag matches nodeenv_version before building the sdist and wheel.
  • Validates distribution metadata and adds a wheel installation smoke test.
  • Publishes the build artifacts through the pypi environment, with SHA-pinned actions and OIDC permission limited to the publish job.
File Description
.github/​workflows/​release.yml Adds separate build-validation and trusted-publishing jobs for version-tag releases.

Review effort: Balanced

run: |
set -euo pipefail
python -m venv "${RUNNER_TEMP}/smoke"
"${RUNNER_TEMP}/smoke/bin/python" -m pip install --quiet dist/*.whl

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Release cadence: observations and a possible automation offer

2 participants